/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DBM;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ResourceBundle;

/**
 *
 * @author CKCantillas
 */
public class DBConnection {
    public static String driver, url, username, password;
    
    public DBConnection() {
        ResourceBundle settings = ResourceBundle.getBundle("dbcredentials");
        
        driver = settings.getString("driver");
        url = settings.getString("url");
        username = settings.getString("username");
        password = settings.getString("password");
    }
    
    public Connection getConnection() {
        
        try {
            Class.forName(driver);
            
            Connection conn = DriverManager.getConnection(url, username, password);
            
            return conn;
        } catch (Exception ex){
            ex.printStackTrace();
        }
        
        return null;
    }
}
